<div id="sidebar">
<a href="index.php?toggle_sidebar=true" onclick="toggle_sidebar('templates/{$settings.template}/images/hide_sidebar.png','templates/{$settings.template}/images/show_sidebar.png'); return false;">
<img id="sidebartoggle" src="templates/{$settings.template}/images/{if $usersettings.sidebar==0}show_sidebar.png{else}hide_sidebar.png{/if}" title="{#toggle_sidebar#}" alt="[+/-]" width="9" height="9" /></a>
<h3 class="sidebar"><a href="index.php?toggle_sidebar=true" title="{#toggle_sidebar#}" onclick="toggle_sidebar('templates/{$settings.template}/images/hide_sidebar.png','templates/{$settings.template}/images/show_sidebar.png'); return false;">{#sidebar#}</a></h3>
<div id="sidebarcontent"{if $usersettings.sidebar==0} style="display:none;"{/if}>
{if $latest_postings}
<div id="latest-postings" {if $usersettings.latest_postings==0} style="width:7em;"{/if}>
<h3>{#latest_postings_hl#}</h3>
<ul id="latest-postings-container"{if $usersettings.latest_postings==0} style="display:none;"{/if}>
{foreach from=$latest_postings item=posting}
<li><a href="index.php?id={$posting.id}" title="{$posting.name}, {$posting.formated_time}
{if $posting.category_name} ({$posting.category_name})
{/if}"{* onmouseover="highlight_posting('thread-{$posting.tid}','transparent','posting-{$posting.id}','#ff9')" 
onmouseout="highlight_posting('thread-{$posting.tid}','transparent','posting-{$posting.id}','transparent')"*}>
<span{if $visited && in_array($posting.id,$visited)} class="visited"{/if}>
{if $posting.pid==0}<strong>{$posting.subject|truncate:29:"..."}</strong>
{else}{$posting.subject|truncate:29:"..."}{/if}</span><br />
{if $posting.days_ago==0 && $posting.hours_ago==0}
{#posting_minutes_ago#|replace:"[minutes]":$posting.minutes_ago}
{elseif $posting.days_ago==0 && $posting.hours_ago!=0}
{#posting_hours_ago#|replace:"[hours]":$posting.hours_ago|replace:"[minutes]":$posting.minutes_ago}
{else}{#posting_days_ago#|replace:"[days]":$posting.days_ago|replace:"[hours]":$posting.hours_ago|replace:"[minutes]":$posting.minutes_ago}
{/if}</a></li>{/foreach}
</ul>
</div>
{/if}
{include file="$template/index.sidebar.tpl.inc"}
{if $admin || $mod}
<div id="modmenu">
<h3>{#options#}</h3>
<ul>
<li><a href="index.php?mode=posting&amp;manage_postings=true" target="_foreign"><img src="templates/{$template}/images/manage_postings.png" alt="" width="13" height="9" />{#manage_postings_link#}</a></li>
{if $show_spam_link}<li><a href="index.php?show_spam=true"><img src="templates/{$template}/images/spam_link.png" alt="" width="13" height="9" />{$smarty.config.show_spam_link|replace:"[number]":$total_spam}</a></li>{/if}
{if $hide_spam_link}<li><a href="index.php?show_spam=true"><img src="templates/{$template}/images/spam_link.png" alt="" width="13" height="9" />{$smarty.config.hide_spam_link|replace:"[number]":$total_spam}</a></li>{/if}
{if $delete_spam_link}<li><a href="index.php?mode=posting&amp;delete_spam=true"><img src="templates/{$template}/images/delete_small.png" alt="" width="13" height="9" />{#delete_spam_link#}</a></li>{/if}
</ul>
</div>
{/if}
</div>
</div>
<script type="text/javascript">/* <![CDATA[ */
{if $admin || $mod}
function mk(id)
{literal}{{/literal}
mark(id,'templates/{$settings.template}/images/marked.png','templates/{$settings.template}/images/unmarked.png','templates/{$settings.template}/images/mark_process.png','{$smarty.config.mark_linktitle|escape:"url"}','{$smarty.config.unmark_linktitle|escape:"url"}');
{literal}}{/literal}
function dl(ths)
{literal}{{/literal}
return delete_posting_confirm(ths, '{$smarty.config.delete_posting_confirm_admin|escape:"url"}')
{literal}}{/literal}
function dr(ths)
{literal}{{/literal}
return drain_posting_confirm(ths, '{$smarty.config.drain_posting_confirm_admin|escape:"url"}')
{literal}}{/literal}
function undr(ths)
{literal}{{/literal}
return undrain_posting_confirm(ths, '{$smarty.config.undrain_posting_confirm_admin|escape:"url"}')
{literal}}{/literal}
function fd(ths)
{literal}{{/literal}
return fold_posting_confirm(ths, '{$smarty.config.fold_posting_confirm_admin|escape:"url"}')
{literal}}{/literal}
function unfd(ths)
{literal}{{/literal}
return unfold_posting_confirm(ths, '{$smarty.config.unfold_posting_confirm_admin|escape:"url"}')
{literal}}{/literal}
{/if}
function ap(id)
{literal}{{/literal}
document.write(' <a href="#" onclick="ajax_preview('+id+'); return false" title="{#ajax_preview_title#}" onfocus="this.blur()"><img src="templates/{$settings.template}/images/ajax_preview.png" title="{#ajax_preview_title#}" alt="[��]" width="11" height="11" /></a>'); 
{literal}}{/literal}
function at(id)
{literal}{{/literal}
document.write(' <a href="#" onclick="ajax_thread('+id+'); return false" title="{#ajax_thread_title#}" onfocus="this.blur()"><img src="templates/{$settings.template}/images/ajax_preview.png" title="{#ajax_thread_title#}" alt="[��]" width="11" height="11" /></a>'); 
{literal}}{/literal}
{if $fold_threads==1}
function ft(id,replies)
{literal}{{/literal} 
if(replies > 0) document.write('<a id="expand_link_'+id+'" href="#" 
onclick="fold_thread('+id+',\'templates/{$settings.template}/images/expand_thread.png\',\'templates/{$settings.template}/images/fold_thread.png\',\'{#expand_thread_linktitle#}\',\'{#fold_thread_linktitle#}\'); return false" 
title="{#expand_thread_linktitle#}"><img id="expand_img_'+id+'" src="templates/{$settings.template}/images/expand_thread.png" title="{#expand_thread_linktitle#}" alt="[+]" width="9" height="11" /></a> ');
else document.write('<img id="expand_img_'+id+'" src="templates/{$settings.template}/images/expand_thread_inactive.png" alt="[+]" width="9" height="11" /> ');
{literal}}{/literal}
{/if}
/* ]]> */</script>

{if $tree}
{defun name="tree" list=$tree level=0}
{assign var=level value=$level+1}
{foreach from=$list item=element}
{if is_array($element)}<ul
{if $level==1} id="thread-{$element.0}"
{elseif $level>1 && $fold_threads==1} style="display:none;"{/if} class="{
if $level==1}thread{elseif $level>1&&$level<$settings.deep_reply}reply{
elseif $level>=$settings.deep_reply&&$level<$settings.very_deep_reply}deep-reply{
else}very-deep-reply{/if}">{fun name="tree" list=$element level=$level}</li></ul>{
else}
	<li>{if $data.$element.category_name && $data.$element.pid==0 && $category==0} <a href="index.php?mode=index&amp;category={$data.$element.category}" 
	title="{#change_category_link#|replace:"[category]":$data.$element.category_name|escape:"html"}">
	<span class="category-regusize">[{$data.$element.category_name|replace:" ":"&nbsp;"}]</span></a>{/if}
	<span class="hot">{if $data.$element.deleted==0}{if $data.$element.comment!=""}[{$data.$element.comment}]{elseif $data.$element.folded==1}[{#fold_posting_comment#}]{/if}{/if}</span>
	{if $fold_threads==1 && $data.$element.pid==0}
		<script type="text/javascript">/* <![CDATA[ */ ft({$data.$element.id},{$data.$element.replies}) /* ]]> */</script>
	{/if}
	{if $data.$element.deleted==1}<span class="hot">
		<a class="{if $data.$element.pid==0}deletedthread{
					else}deletedreply{/if}" 
				href="index.php?id={$data.$element.id}"
					{if $data.$element.spam==1} title="{#spam#}"{/if} target="_blank">
	 {if $data.$element.comment==""} {#drain_posting_comment#}  {else}[{$data.$element.comment}]{/if}</a></span>{/if}
	{if $data.$element.deleted==0}
	{if $data.$element.no_text&&$data.$element.folded==0}
		<img src="{if $data.$element.pid==0}{
				     if $data.$element.sticky==1}{
					   if $last_visit&&$data.$element.last_reply>$last_visit}templates/default/images/thread_new_sticky.png{
					   else}templates/default/images/thread_sticky.png{/if}{
					 else}{
					   if $last_visit&&$data.$element.last_reply>$last_visit}templates/default/images/thread_new.png{
					   else}templates/default/images/thread.png{/if}{
					 /if}{
				  else}{
				  	   if $last_visit&&$data.$element.time>$last_visit}templates/default/images/reply_new.png{
					   else}templates/default/images/reply.png{/if}{
				  /if}"
					></img>&nbsp;<span 
					class= "{
					if $data.$element.pid==0}{
				      if $data.$element.sticky==1}{
					    if $last_visit&&$data.$element.last_reply>$last_visit}threadnew-sticky_no_text_nobg{
					    else}thread-sticky_no_text_nobg{/if}{
					  else}{
					    if $last_visit&&$data.$element.last_reply>$last_visit}threadnew_no_text_nobg{
					    else}thread_no_text_nobg{/if}{
					  /if}{
					else}{
						if $last_visit&&$data.$element.time>$last_visit}replynew_no_text_nobg{
						else}reply_no_text_nobg{/if}{
					/if}">{
	else}<a href="index.php?id={$data.$element.id}"
					{if $data.$element.spam==1} title="{#spam#}"{/if} target="_blank">
		     <img src="{if $data.$element.pid==0}{
				     if $data.$element.sticky==1}{
					   if $last_visit&&$data.$element.last_reply>$last_visit}templates/default/images/thread_new_sticky.png{
					   else}templates/default/images/thread_sticky.png{/if}{
					 else}{
					   if $last_visit&&$data.$element.last_reply>$last_visit}templates/default/images/thread_new.png{
					   else}templates/default/images/thread.png{/if}{
					 /if}{
				  else}{
				  	   if $last_visit&&$data.$element.time>$last_visit}{
					     if $visited && in_array($data.$element.id,$visited)}templates/default/images/reply.png{
					     else}templates/default/images/reply_new.png{/if}{
					   else}templates/default/images/reply.png{
					   /if}{
				  /if}"></img></a>&nbsp;<a 
					class="{
					if $data.$element.pid==0}{
				      if $data.$element.sticky==1}{
					    if $last_visit&&$data.$element.last_reply>$last_visit}threadnew-sticky_nobg{
					    else}thread-sticky_nobg{/if}{
					  else}{
					    if $last_visit&&$data.$element.last_reply>$last_visit}threadnew_nobg{
					    else}thread_nobg{/if}{
					  /if}{
					else}{
				  	    if $last_visit&&$data.$element.time>$last_visit}{
						   if $visited && in_array($data.$element.id,$visited)}reply_nobg{
						   else}replynew_nobg{/if}{
						else}reply_nobg{
						/if}{
					/if}"
				href="index.php?id={$data.$element.id}"
					{if $data.$element.spam==1} title="{#spam#}"{/if} target="_blank">{
	/if}{
	if $data.$element.spam==1}<span class="spam">{$data.$element.subject}</span>{
	else}{
	  if $data.$element.pid!=0}{
	      assign var="parent_posting" value=$data.$element.pid}<span class="{if $data.$parent_posting.reg_name==$user }highlightthread{/if}">{
	  /if}{
	     $data.$element.subject}{if $data.$element.pid!=0}</span>{/if}{
	/if}{
	if $data.$element.no_text&&$data.$element.folded==0}</span>{else}</a>{
	/if}
{if $data.$element.url}&nbsp;<a href="{$data.$element.url}" title="{$data.$element.url}" target="_blank" class="hotlink"><img src="templates/default/images/ext_link.png" alt="{#url_marking#}" width="14px" height="14px"/></a>{/if}
{if $data.$element.pic}&nbsp;<a href="{$data.$element.pic}" title="{$data.$element.pic}" target="_blank" class="hotlink"><img src="templates/default/images/ext_link.png" alt="{#pic_marking#}" width="14px" height="14px"/></a>{/if}
 --<a href = "index.php?mode=user&show_user={$data.$element.user_id}" target="htkou_showuser"><span class="grey">{$data.$element.reg_name}</span></a>{
if $data.$element.user_type==2}<span class="admin" title="{#administrator_title#}">{
elseif $data.$element.user_type==1}<span class="mod" title="{#moderator_title#}">{
else}<span class="user">{
/if}
{$data.$element.nick_name}</span>;{/if}
{if $last_visit&&$data.$element.time>$last_visit && $data.$element.deleted==1}
<b><span class="{$data.$element.formated_time_class}"> {$data.$element.formated_time}</span></b>{elseif $data.$element.deleted==0}
{if $last_visit&&$data.$element.time>$last_visit}<b>{/if}
<span class="{$data.$element.formated_time_class}"> {$data.$element.formated_time}</span>{
if $last_visit&&$data.$element.time>$last_visit}</b>{/if}{/if} (#{$data.$element.id}){if $data.$element.deleted==0}{
if $data.$element.folded==0}{
	if $data.$element.no_text}{if $data.$element.locked ==0}<a href="index.php?mode=posting&amp;id={$data.$element.id}" target="_blank"><span class="grey"> Reply</span></a>{/if}{
	else}<script type="text/javascript">/* <![CDATA[ */ at({$data.$element.id}); /* ]]> */</script>{
	/if}{
else}<a href="index.php?mode=thread&amp;id={$data.$element.id}" title="{#open_whole_thread#}">
     <img src="templates/{$settings.template}/images/complete_thread.png" title="{#open_whole_thread#}" alt="[*]" width="11" height="11" /></a>
{/if}
{/if}
{if $admin || $mod} {if 0}<a id="marklink_{$data.$element.id}" href="index.php?mode=posting&amp;mark={$data.$element.id}" title="{#mark_linktitle#}" 
onclick="mk({$data.$element.id}); return false" onfocus="this.blur()">

{if $data.$element.marked==0}
<img id="markimg_{$data.$element.id}" src="templates/{$settings.template}/images/unmarked.png" 
title="{#mark_linktitle#}" alt="[��]" width="11" height="11" />
{else}<img id="markimg_{$data.$element.id}" src="templates/{$settings.template}/images/marked.png" 
title="{#unmark_linktitle#}" alt="[��]" width="11" height="11" title="{#unmark_linktitle#}" />
{/if}
</a>{/if}{if $data.$element.deleted==0} <a href="index.php?mode=posting&amp;drain_posting={$data.$element.id}&amp;back=index" 
title="{#drain_posting_title#}" onclick="return dr(this)" title="{#drain_posting_title#}">
<img src="templates/{$template}/images/delete_small_2.png" title="{#drain_posting_title#}" alt="[x]" width="9" height="9" /></a>
{else} <a href="index.php?mode=posting&amp;drain_posting={$data.$element.id}&amp;back=index" 
title="{#undrain_posting_title#}" onclick="return undr(this)" title="{#undrain_posting_title#}">
<img src="templates/{$template}/images/mark_process.png" title="{#undrain_posting_title#}" alt="[x]" width="9" height="9" /></a>
{if $settings.show_edited_by}<a href = "index.php?mode=user&show_user={$data.$element.edited_by}" target="htkou_showuser"><img src="templates/{$template}/images/user.png" title="{#edited_by#}" alt="[x]" width="10" height="10" /></a>{/if}
{/if}
{if $data.$element.deleted==0}
{if $data.$element.folded==0}<a href="index.php?mode=posting&amp;fold_posting={$data.$element.id}&amp;back=index" 
 onclick="return fd(this)" title="{#fold_posting_title#}">
<img src="templates/{$template}/images/fold_thread.png" title="{#fold_posting_title#}" alt="[x]" width="9" height="9" /></a>
{else}<a href="index.php?mode=posting&amp;fold_posting={$data.$element.id}&amp;back=index" 
 onclick="return unfd(this)" title="{#unfold_posting_title#}">
<img src="templates/{$template}/images/expand_thread.png" title="{#unfold_posting_title#}" alt="[x]" width="9" height="9" /></a>
{/if}
{/if}
{/if}

{if $data.$element.pid==0 && $fold_threads==1} <span class="small" title="{if $data.$element.replies==0}{#no_replies#}
{elseif $data.$element.replies==1}{#one_reply#}
{else}{$smarty.config.several_replies|replace:"[replies]":$data.$element.replies}{/if}">({$data.$element.replies})</span>{/if}

{if $data.$element.no_text==false&& $data.$element.folded==0} <li id="at_{$data.$element.id}"  width="100%" >
<fieldset id="atf_{$data.$element.id}" style="padding: 10px; display: none;" ondblclick="hide_element('atf_{$data.$element.id}')" ><div  class="posting" id="atc_{$data.$element.id}"></div>
<div id="areply_{$data.$element.id}">{if $data.$element.locked==0}[ <a id="replylink" href="index.php?mode=posting&id={$data.$element.id};" target="_blank">{#reply_link#}</a> ]{/if} [ <a id="ajax-thread-close" href="#" onclick="hide_element('atf_{$data.$element.id}'); return false">{#close#}</a> ]</div></fieldset></li>{/if}
{/if}{/foreach}{/defun}
{else}<p>{if $category!=0}{#no_messages_in_category#}{else}{#no_messages#}{/if}</p>{/if}

{if $browse_array}<p class="pagebrowse">{if $page > 1}<a href="index.php?mode={$mode}&amp;page={$page-1}
{if $category}&amp;category={$category}{/if}">{#previous_page_link#}</a>{/if}{if $page < $page_count}
{if $page > 1 && $page < $page_count} - {/if}<a href="index.php?mode={$mode}&amp;page={$page+1}
{if $category}&amp;category={$category}{/if}">{#next_page_link#}</a>{/if}</p>{/if}

{include file="$template/ajax_preview.tpl.inc"}
